﻿using System;
using System.Collections.Generic;
using System.Text;

namespace KaiXin001er.Objects
{
    public class ParkUserData
    {
        /// <summary>
        /// 错误信息
        /// </summary>
        private string error;

        public string Error
        {
            get { return error; }
            set { error = value; }
        }
        /// <summary>
        /// 场景配置
        /// </summary>
        private ParkUserDataConfiger config;

        public ParkUserDataConfiger Config
        {
            get { return config; }
            set { config = value; }
        }
        /// <summary>
        /// 用户信息
        /// </summary>
        private ParkUserDataUser user;

        public ParkUserDataUser User
        {
            get { return user; }
            set { user = value; }
        }
        /// <summary>
        /// 用户车位信息
        /// </summary>
        private ParkUserDataParking[] parking;

        public string Full
        {
            
            get 
            {
                //过一遍收费车位 如果有就说明没满
                foreach (ParkUserDataParking p in parking)
                {
                    if (p.Carid == null && (!p.isFreePark)) return "0";
                }
                //过一遍免费车位 如果有说明免费的车位没有满
                foreach (ParkUserDataParking p in parking)
                {
                    if (p.Carid == null && (!p.isFreePark)) return "2";
                }
                //满了
                return "1";
            
            }
        }
        public ParkUserDataParking[] CanParking
        {
            get
            {
                List<ParkUserDataParking> canParks= new List<ParkUserDataParking>();
                foreach (ParkUserDataParking p in parking)
                {
                    if (p.Carid == null) canParks.Add(p);
                }
                return canParks.ToArray();
            }
        }

        public ParkUserDataParking[] Parking
        {
            get { return parking; }
            set { parking = value; }
        }
        /// <summary>
        /// 用户车信息
        /// </summary>
        private ParkUserDataCar[] car;

        public ParkUserDataCar[] Car
        {
            get { return car; }
            set { car = value; }
        }

    }
    public class ParkUserDataConfiger
    {
        /// <summary>
        /// 每分钟收益
        /// </summary>
        private string _money_minute;

        public string Money_minute
        {
            get { return _money_minute; }
            set { _money_minute = value; }
        }
        /// <summary>
        /// 最大收益
        /// </summary>
        private double? money_max;

        public double? Money_max
        {
            get { return money_max; }
            set { money_max = value; }
        }
    }
    public class ParkUserDataUser
    {
        /// <summary>
        /// 访问UID?
        /// </summary>
        private string vuid;

        public string Vuid
        {
            get { return vuid; }
            set { vuid = value; }
        }
        /// <summary>
        /// 被访问的UID?
        /// </summary>
        private string uid;

        public string Uid
        {
            get { return uid; }
            set { uid = value; }
        }
        /// <summary>
        /// 是否Neighbor? 0 不是 1是
        /// </summary>
        private int? neighbor;

        public int? Neighbor
        {
            get { return neighbor; }
            set { neighbor = value; }
        }
        /// <summary>
        /// 是否好友?
        /// </summary>
        private int? isfriend;

        public int? Isfriend
        {
            get { return isfriend; }
            set { isfriend = value; }
        }
        /// <summary>
        /// 第一个收费位置?
        /// </summary>
        private int? first_fee_parking;

        public int? First_fee_parking
        {
            get { return first_fee_parking; }
            set { first_fee_parking = value; }
        }
        /// <summary>
        /// 第一个不收费位置?
        /// </summary>
        private int? first_free_parking;

        public int? First_free_parking
        {
            get { return first_free_parking; }
            set { first_free_parking = value; }
        }
        /// <summary>
        /// 真实姓名
        /// </summary>
        private string real_name;

        public string Real_name
        {
            get { return real_name; }
            set { real_name = value; }
        }
        /// <summary>
        /// 男女
        /// </summary>
        private string ta;

        public string Ta
        {
            get { return ta; }
            set { ta = value; }
        }
        /// <summary>
        /// logo50
        /// </summary>
        private string logo50;

        public string Logo50
        {
            get { return logo50; }
            set { logo50 = value; }
        }
        /// <summary>
        /// logo20
        /// </summary>
        private string logo20;

        public string Logo20
        {
            get { return logo20; }
            set { logo20 = value; }
        }
        /// <summary>
        /// 场景名子
        /// </summary>
        private string avenue;

        public string Avenue
        {
            get { return avenue; }
            set { avenue = value; }
        }
        /// <summary>
        /// 现金
        /// </summary>
        private string cash;

        public string Cash
        {
            get { return cash; }
            set { cash = value; }
        }
        /// <summary>
        /// 场景URLs
        /// </summary>
        private string scene;

        public string Scene
        {
            get { return scene; }
            set { scene = value; }
        }
        /// <summary>
        /// 场景ID
        /// </summary>
        private string sceneid;

        public string Sceneid
        {
            get { return sceneid; }
            set { sceneid = value; }
        }
        /// <summary>
        /// showmoneyminute
        /// </summary>
        private int? showmoneyminute;

        public int? Showmoneyminute
        {
            get { return showmoneyminute; }
            set { showmoneyminute = value; }
        }
        /// <summary>
        /// online2
        /// </summary>
        private int? online2;

        public int? Online2
        {
            get { return online2; }
            set { online2 = value; }
        }
    }
    public class ParkUserDataParking
    {
        public bool isFreePark
        {
            get
            {
                int ret = 0;
                if (int.TryParse(parkid, out ret))
                {
                    return (((ret >> 0x10) & 0xffL) != 0L);
                } return true;
            }
        }
        /// <summary>
        /// 停车位的ID
        /// </summary>
        private string parkid;

        public string Parkid
        {
            get { return parkid; }
            set { parkid = value; }
        }
        /// <summary>
        /// 停车位上的车主ID
        /// </summary>
        private string car_uid;

        public string Car_uid
        {
            get { return car_uid; }
            set { car_uid = value; }
        }
        /// <summary>
        /// 停车位上车的ID
        /// </summary>
        private string carid;

        public string Carid
        {
            get { return carid; }
            set { carid = value; }
        }
        /// <summary>
        /// 停车时间?
        /// </summary>
        private int? ctime;

        public int? Ctime
        {
            get { return ctime; }
            set { ctime = value; }
        }
        /// <summary>
        /// 车主的名字
        /// </summary>
        private string car_real_name;

        public string Car_real_name
        {
            get { return car_real_name; }
            set { car_real_name = value; }
        }
        /// <summary>
        /// car_logo20
        /// </summary>
        private string car_logo20;

        public string Car_logo20
        {
            get { return car_logo20; }
            set { car_logo20 = value; }
        }
        /// <summary>
        /// 是不是好友的车 如果是可能可以报警或者贴条吧
        /// </summary>
        private int? car_isfriend;

        public int? Car_isfriend
        {
            get { return car_isfriend; }
            set { car_isfriend = value; }
        }
        /// <summary>
        /// car_logo_big
        /// </summary>
        private string car_logo_big;

        public string Car_logo_big
        {
            get { return car_logo_big; }
            set { car_logo_big = value; }
        }
        /// <summary>
        /// car_logo_small
        /// </summary>
        private string car_logo_small;

        public string Car_logo_small
        {
            get { return car_logo_small; }
            set { car_logo_small = value; }
        }
        /// <summary>
        /// car_logo_flash
        /// </summary>
        private string car_logo_flash;

        public string Car_logo_flash
        {
            get { return car_logo_flash; }
            set { car_logo_flash = value; }
        }
        /// <summary>
        /// 是不是警车
        /// </summary>
        private string car_police;

        public string Car_police
        {
            get { return car_police; }
            set { car_police = value; }
        }
        /// <summary>
        /// 当前收益
        /// </summary>
        private int? car_profit;

        public int? Car_profit
        {
            get { return car_profit; }
            set { car_profit = value; }
        }
        /// <summary>
        /// 车牌URL
        /// </summary>
        private string car_trademark;

        public string Car_trademark
        {
            get { return car_trademark; }
            set { car_trademark = value; }
        }
        /// <summary>
        /// 车牌名称
        /// </summary>
        private string car_trademarkname;

        public string Car_trademarkname
        {
            get { return car_trademarkname; }
            set { car_trademarkname = value; }
        }
        /// <summary>
        /// 车价
        /// </summary>
        private string car_price;

        public string Car_price
        {
            get { return car_price; }
            set { car_price = value; }
        }
        /// <summary>
        /// 车名
        /// </summary>
        private string car_name;

        public string Car_name
        {
            get { return car_name; }
            set { car_name = value; }
        }
    }
    public class ParkUserDataCar
    {
        /// <summary>
        /// 车辆ID
        /// </summary>
        private string carid;

        public string Carid
        {
            get { return carid; }
            set { carid = value; }
        }
        /// <summary>
        /// 车价
        /// </summary>
        private string price;

        public string Price
        {
            get { return price; }
            set { price = value; }
        }
        /// <summary>
        /// 是否停在邻居上?
        /// </summary>
        private string neighbor;

        public string Neighbor
        {
            get { return neighbor; }
            set { neighbor = value; }
        }
        /// <summary>
        /// 车位主人ID
        /// </summary>
        private string park_uid;

        public string Park_uid
        {
            get { return park_uid; }
            set { park_uid = value; }
        }
        /// <summary>
        /// 车位ID
        /// </summary>
        private string parkid;

        public string Parkid
        {
            get { return parkid; }
            set { parkid = value; }
        }
        /// <summary>
        /// 停车时间
        /// </summary>
        private int? ctime;

        public int? Ctime
        {
            get { return ctime; }
            set { ctime = value; }
        }
        /// <summary>
        /// ctype颜色?
        /// </summary>
        private string ctype;

        public string Ctype
        {
            get { return ctype; }
            set { ctype = value; }
        }
        /// <summary>
        /// 车名称
        /// </summary>
        private string car_name;

        public string Car_name
        {
            get { return car_name; }
            set { car_name = value; }
        }
        /// <summary>
        /// 
        /// </summary>
        private string car_logo_big;

        public string Car_logo_big
        {
            get { return car_logo_big; }
            set { car_logo_big = value; }
        }
        /// <summary>
        /// 
        /// </summary>
        private string car_logo_small;

        public string Car_logo_small
        {
            get { return car_logo_small; }
            set { car_logo_small = value; }
        }
        /// <summary>
        /// 
        /// </summary>
        private string car_logo_flash;

        public string Car_logo_flash
        {
            get { return car_logo_flash; }
            set { car_logo_flash = value; }
        }
        /// <summary>
        /// 品牌地址
        /// </summary>
        private string car_trademark;

        public string Car_trademark
        {
            get { return car_trademark; }
            set { car_trademark = value; }
        }
        /// <summary>
        /// 品牌名称
        /// </summary>
        private string car_trademarkname;

        public string Car_trademarkname
        {
            get { return car_trademarkname; }
            set { car_trademarkname = value; }
        }
        /// <summary>
        /// 是否警车
        /// </summary>
        private string car_police;

        public string Car_police
        {
            get { return car_police; }
            set { car_police = value; }
        }
        /// <summary>
        /// 车位主人名字
        /// </summary>
        private string park_real_name;

        public string Park_real_name
        {
            get { return park_real_name; }
            set { park_real_name = value; }
        }
        /// <summary>
        /// park_logo20
        /// </summary>
        private string park_logo20;

        public string Park_logo20
        {
            get { return park_logo20; }
            set { park_logo20 = value; }
        }
        /// <summary>
        /// 收益
        /// </summary>
        private int? park_profit;

        public int? Park_profit
        {
            get { return park_profit; }
            set { park_profit = value; }
        }
        /// <summary>
        /// 每分钟收益
        /// </summary>
        private int? park_moneyminute;

        public int? Park_moneyminute
        {
            get { return park_moneyminute; }
            set { park_moneyminute = value; }
        }
    }
}
